﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace Rud.Holmgren.Tabulex3000.Util
{
    
    public class BitToVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int map = System.Convert.ToInt32(value);
            int mask = System.Convert.ToInt32(parameter);

            return (map & mask) != 0 ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
            // throw new NotImplementedException();
        }
    }
}
